home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 25 / CU Amiga Magazine's Super CD-ROM 25 (1998)(EMAP Images)(GB)(Track 1 of 2)[!][issue 1998-08].iso / CUCD / Programming / ixemul / sdk / man / cat5 / dir.0 < prev    next >
Encoding:
File List  |  1998-06-15  |  3.6 KB  |  100 lines

  1.  
  2. DIR(5)                     UNIX Programmer's Manual                     DIR(5)
  3.  
  4. NNAAMMEE
  5.      ddiirr, ddiirreenntt - directory file format
  6.  
  7. SSYYNNOOPPSSIISS
  8.      ##iinncclluuddee <<ssyyss//ttyyppeess..hh>>
  9.      ##iinncclluuddee <<ssyyss//ddiirr..hh>>
  10.  
  11. DDEESSCCRRIIPPTTIIOONN
  12.      Directories provide a convenient hierarchical method of grouping files
  13.      while obscuring the underlying details of the storage medium.  A directo-
  14.      ry file is differentiated from a plain file by a flag in its inode(5) en-
  15.      try.  It consists of records (directory entries) each of which contains
  16.      information about a file and a pointer to the file itself.  Directory en-
  17.      tries may contain other directories as well as plain files; such nested
  18.      directories are refered to as subdirectories.  A hierarchy of directories
  19.      and files is formed in this manner and is called a file system (or re-
  20.      ferred to as a file system tree).
  21.  
  22.      Each directory file contains two special directory entries; one is a
  23.      pointer to the directory itself called dot `.' and the other a pointer to
  24.      its parent directory called dot-dot `..'. Dot and dot-dot are valid path-
  25.      names, however, the system root directory `/', has no parent and dot-dot
  26.      points to itself like dot.
  27.  
  28.      File system nodes are ordinary directory files on which has been grafted
  29.      a file system object, such as a physical disk or a partitioned area of
  30.      such a disk.  (See mount(1) and mount(8).)
  31.  
  32.      The directory entry format is defined in the file <dirent.h>:
  33.  
  34.      #ifndef _DIRENT_H_
  35.      #define _DIRENT_H_
  36.  
  37.      /*
  38.      * A directory entry has a struct dirent at the front of it, containing its
  39.      * inode number, the length of the entry, and the length of the name
  40.      * contained in the entry.  These are followed by the name padded to a 4
  41.      * byte boundary with null bytes.  All names are guaranteed null terminated.
  42.      * The maximum length of a name in a directory is MAXNAMLEN.
  43.      */
  44.  
  45.      struct dirent {
  46.              u_long  d_fileno;       /* file number of entry */
  47.              u_short d_reclen;       /* length of this record */
  48.              u_short d_namlen;       /* length of string in d_name */
  49.      #ifdef _POSIX_SOURCE
  50.              char    d_name[MAXNAMLEN + 1];  /* maximum name length */
  51.      #else
  52.      #define MAXNAMLEN       255
  53.              char    d_name[MAXNAMLEN + 1];  /* maximum name length */
  54.      #endif
  55.  
  56.      };
  57.  
  58.      #ifdef _POSIX_SOURCE
  59.      typedef void *  DIR;
  60.      #else
  61.  
  62.      #define d_ino           d_fileno        /* backward compatibility */
  63.  
  64.      /* definitions for library routines operating on directories. */
  65.      #define DIRBLKSIZ       1024
  66.  
  67.      /* structure describing an open directory. */
  68.      typedef struct _dirdesc {
  69.              int     dd_fd;    /* file descriptor associated with directory */
  70.              long    dd_loc;   /* offset in current buffer */
  71.              long    dd_size;  /* amount of data returned by getdirentries */
  72.              char    *dd_buf;  /* data buffer */
  73.              int     dd_len;   /* size of data buffer */
  74.              long    dd_seek;  /* magic cookie returned by getdirentries */
  75.      } DIR;
  76.  
  77.      #define dirfd(dirp)     ((dirp)->dd_fd)
  78.  
  79.      #ifndef NULL
  80.      #define NULL    0
  81.      #endif
  82.  
  83.      #endif /* _POSIX_SOURCE */
  84.  
  85.      #ifndef _KERNEL
  86.  
  87.      #include <sys/cdefs.h>
  88.  
  89.      #endif /* !_KERNEL */
  90.  
  91.      #endif /* !_DIRENT_H_ */
  92.  
  93. SSEEEE AALLSSOO
  94.      fs(5),  inode(5)
  95.  
  96. HHIISSTTOORRYY
  97.      A ddiirr file format appeared in Version 7 AT&T UNIX.
  98.  
  99. 4.2 Berkeley Distribution       April 19, 1994                               2
  100.